package com.wjk.kylin.mall.gateway.feign.fallback;

import com.wjk.kylin.mall.gateway.feign.AdminFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;


/**
 * 调用方熔断保护 Factory
 * 可以打印异常等处理
 */
@Slf4j
@Service
public class AdminFeignServiceFallbackFactory implements FallbackFactory<AdminFeignService> {

    @Override
    public AdminFeignService create(Throwable throwable) {
        return inDTO -> {
            log.error("mall-admin,getRoleIdByComponent 熔断异常：{}", throwable.getMessage());
            return null;
        };
    }
}
